package com.hex.liyue.giftmodule.presenter;

import com.hex.liyue.commonmodule.manager.HttpManager;
import com.hex.liyue.commonmodule.manager.UserManager;
import com.hex.liyue.commonmodule.net.ResponseListener;
import com.hex.liyue.commonmodule.utils.L;
import com.hex.liyue.giftmodule.bean.DiscountDetailsBean;
import com.hex.liyue.giftmodule.bean.DiscountGiftsBean;


/**
 * Created by $cmm on 2016/6/21.
 * <p/>
 * 折现礼物列表的业务类
 */
public class DiscountDetailsPresenter {
    private IDiscountDetailsView iDiscountDetailsView;

    public DiscountDetailsPresenter(IDiscountDetailsView iDiscountDetailsView) {
        this.iDiscountDetailsView = iDiscountDetailsView;
    }

    public void getDiscountDetailsGifts(String user_gift_cash_id) {
        iDiscountDetailsView.showLod("加载中...");
        HttpManager.getInstance().getDiscountDetailsGifts(UserManager.getUserId(),user_gift_cash_id, new ResponseListener<DiscountDetailsBean>() {
            @Override
            public void onSuccess(DiscountDetailsBean discountGiftsBean) {
                L.e("discountGiftsBean", discountGiftsBean.toString());
                iDiscountDetailsView.closeLod();
                iDiscountDetailsView.setAdapter(discountGiftsBean);
            }

            @Override
            public void onFailure(String responseresult) {
                iDiscountDetailsView.closeLod();
                iDiscountDetailsView.showT(responseresult);
            }
        });
    }
}
